package com.leeon.container.iterator;

import typeinfo.pets.Hamster;
import typeinfo.pets.Pet;
import typeinfo.pets.Pets;
import typeinfo.pets.Rat;

import java.util.LinkedList;

import static net.mindview.util.Print.print;

public class LinkedListFeatures {

    public static void main(String[] args){
        LinkedList<Pet> pets = new LinkedList<Pet>(Pets.arrayList(5));
        print(pets);
        print("pets.getFirst() " + pets.getFirst());
        print("pets.element() " + pets.element());
        print("pets.peek(): " + pets.peek());
        print("pets.remove() " + pets.remove());
        print("pets.removeFirst() " + pets.removeFirst());
        print("pets.poll() " + pets.poll());
        print(pets);
        pets.addFirst(new Rat());
        print("after pets.addFirst() " + pets);
        pets.offer(Pets.randomPet());
        print("after pets.offer() " + pets);
        pets.add(Pets.randomPet());
        print("after pets.add() " + pets);
        pets.addLast(new Hamster());
        print("pets.removeLast() " + pets.removeLast());
    }
}
